// pages/user/user.ts
import { ComponentWithStore } from "mobx-miniprogram-bindings"
import userStore from "../../store/userStore"
import { Data } from "../../type/userTypes"
ComponentWithStore({
  /**
   * 绑定userStore中的数据
   */
  storeBindings: {
    store: userStore,
    fields: ["token", "userInfo"],
    actions: ["fetchUserInfo", "login"]
  },
  /**
   * 页面的初始数据
   */
  data: <Data>{
    initpanel: [
      {
        url: '/subPackages/order/list/list',
        title: '商品订单',
        icon: "../../assets/images/shopOrder.png"
      },
      {
        url: '/pages/order/list/list',
        title: '礼品卡订单',
        icon: "../../assets/images/liPing.png"
      },
      {
        url: '/pages/order/list/list',
        title: '退款/售后',
        icon: "../../assets/images/shouHou.png"
      }
    ]
  },
  methods: {
    /**
     * 
     * @description 跳转到登录页面
     */
    toLoginPage() {
      wx.navigateTo({
        url: '/pages/login/login'
      })
    },
  }
})